package com.cn.lp.export.server;

import com.cn.lp.export.server.base.result.*;

import java.lang.reflect.Field;

/**
 * Created by on 2019/8/6.
 */
public class ExportResultCodes extends ResultCodes {

    static ResultCodeImpl of(int code, String message, ResultCodeType resultCodeType) {
        return new ResultCodeImpl(1000 + code, message, resultCodeType);
    }

    public static final ResultCode1 TASK_NOT_EXIST = of(1, "{} 导出任务不存在", ResultCodeType.WARN);

    public static final ResultCode1 TASK_NOT_IN_READY = of(2, "{} 导出任务已开始", ResultCodeType.WARN);

    public static final ResultCode2 UPLOAD_DATA_REPEAT = of(3, "{} 导出任务上传数据 {} 重复", ResultCodeType.WARN);

    public static void main(String[] args) throws IllegalAccessException {
        //获取所有变量的值
        Field[] fields = ExportResultCodes.class.getFields();

        for (Field field : fields) {
            ResultCode resultCode = (ResultCode) field.get(ExportResultCodes.class);
            System.out.println("code :" + resultCode.getCode() + "-" + resultCode.getRawMessage());
        }

    }
}